﻿<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="utf-8" %>

<form id="form1">
    <div class='myzh_right_content fr'>
        <p class='right_head_title'><span class="span1">我的 ></span> 操作</p>
        <div class="recharge-content">
            <input type="hidden" id="user_id" name="user_id" value="${data.user_id}"/>

            <div class="mt-10">
                <span class="fl mt-3 w-120">用户名称：</span>
                <input type="text" class="txt txt-1 fl w-220" id="login_name" name="login_name"
                       value="${data.login_name}">
                <div class="cl"></div>
            </div>
            <div class="mt-10">
                <span class="fl mt-3 w-120">密码：</span>
                <input type="text" class="txt txt-1 fl w-220" id="password" name="password" value="${data.password}">
                <div class="cl"></div>
            </div>
            <div class="mt-10">
                <span class="fl mt-3 w-120">真实姓名：</span>
                <input type="text" class="txt txt-1 fl w-220" id="name" name="name" value="${data.name}">
                <div class="cl"></div>
            </div>
            <div class="mt-10">
                <span class="fl mt-3 w-120">角色名称：</span>
                <select id="role_id" name="role_id" class="fl w-220">
                    <option value="">请选择角色名称</option>
                    <c:forEach var="role" items="${role_data}">
                        <option value="${role.role_id}">${role.role_name}</option>
                    </c:forEach>
                </select>
                <div class="cl"></div>
            </div>
            <div class="mt-10">
                <span class="fl mt-3 w-120">备注：</span>
                <input type="text" class="txt txt-1 fl w-220" id="memo" name="memo" value="${data.memo}">
                <div class="cl"></div>
            </div>

            <div class="mt-30 ml-10">
                <input type="button" class="btn btn-1 fl w-100" value="${title}" onclick="add()">
                <input type="button" class="btn btn-2 fl w-100 ml-20" value="返回"
                       onclick="window.location='${basePath}/t_mnguser_info/list'">
            </div>
        </div>
    </div>
</form>
<div class='clear'></div>
<script type="text/javascript">
    $(function () {
        var role_id = "${data.role_id}";
        $("#role_id").val(role_id);
    });

    function add() {
        $.post("${basePath}/ajax/t_mnguser_info/add", $("#form1").serialize(), function (d) {
            if (d.code == 1) {
                alert("成功");
                window.location = "${basePath}/t_mnguser_info/list";
                return;
            } else if (d.code == 2) {
                alert("当前管理员已存在，请更换新管理员名称");
                return;
            }
            alert("失败");
        });
    }
</script>


